#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
using namespace std;


bool IsTriangle(vector<int>& nums)
{
    if (nums[0] + nums[1] > nums[2])
        return true;
    else
        return false;
}

int main()
{
    int n;
    cin >> n;
    vector<vector<int>> nums(n, vector<int>(6));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < 6; ++j)
        {
            cin >> nums[i][j];
        }
    }

    vector<string> ret;
    for (int i = 0; i < n; ++i)
    {
        sort(nums[i].begin(), nums[i].end());
        int flag = 0;
        for (int j = 0; j < 4; ++j)
        {
            for (int z = j + 1; z < 5; ++z)
            {
                vector<int> tr1({ nums[i][j],nums[i][z],nums[i][z + 1] });
                vector<int> tr2;
                for (int k = 0; k < 6; ++k)
                {
                    if (k != j && k != z && k != z + 1)
                    {
                        tr2.emplace_back(nums[i][k]);
                    }
                }
                if (IsTriangle(tr1) && IsTriangle(tr2))
                {
                    ret.emplace_back("Yes");
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
                break;
        }
        if (flag == 0)
            ret.emplace_back("No");
    }
    
    for (auto& s : ret)
    {
        cout << s << endl;
    }

    return 0;
}


class Solution1 {
public:
    pair<bool, vector<int>> IsDigit(vector<vector<char>>& grid, int i, int j)
    {
        vector<int> ret(2);
        if (j + 1 < grid[0].size() && grid[i][j + 1] == '1')
        {
            ret[0] = i, ret[1] = j + 1;
            return make_pair(true, ret);
        }
        else if (j - 1 >= 0 && grid[i][j - 1] == '1')
        {
            ret[0] = i, ret[1] = j - 1;
            return make_pair(true, ret);
        }
        else if (i + 1 < grid.size() && grid[i + 1][j] == '1')
        {
            ret[0] = i + 1, ret[1] = j;
            return make_pair(true, ret);
        }
        else if (i - 1 >= 0 && grid[i - 1][j] == '1')
        {
            ret[0] = i - 1, ret[1] = j;
            return make_pair(true, ret);
        }
        else
        {
            return make_pair(false, ret);
        }
    }

    void Modify(vector<vector<char> >& grid, vector<vector<char> >& next_grid, int i, int j, pair<bool, vector<int>> ret)
    {
        int i1 = i, j1 = j;
        while (ret.first)
        {
            next_grid[i1][j1] = '0';
            next_grid[ret.second[0]][ret.second[1]] = '0';
            grid = next_grid;
            if (IsDigit(grid, i1, j1).first)
            {
                Modify(grid, next_grid, i1, j1, IsDigit(grid, i1, j1));
            }
            i1 = ret.second[0], j1 = ret.second[1];
            
            ret = IsDigit(grid, i1, j1);
        }
    }

    int solve(vector<vector<char> >& grid)
    {
        vector<vector<char>> next_grid(grid);
        int time = 0;

        for (int i = 0; i < grid.size(); ++i)
        {
            for (int j = 0; j < grid[0].size(); ++j)
            {
                if (grid[i][j] == '1')
                {
                    auto ret = IsDigit(grid, i, j);
                    if (ret.first)
                    {
                        ++time;
                        Modify(grid, next_grid, i, j, ret);
                    }
                }
            }
        }
        return time;
    }
};


int main()
{
    vector<vector<char>> nums({ {'1','1','0','0','0'},{'0','1','0','1','1'},{'0','0','0','1','1'},{'0','0','0','0','0'},{'0','0','1','1','1' } });
    cout << Solution().solve(nums) << endl;

    return 0;
}




int main1()
{
    string str;
    cin >> str;
    int n = str.size();

    string ret;
    for (int i = 0; i < n;)
    {
        int j = 0;
        if (isdigit(str[i]))
        {
            int j = i + 1;
            while (j < n && isdigit(str[j]))
                ++j;
            string s = str.substr(i, j - i);
            if (s.size() > ret.size())
                ret = s;
        }
        if (j == 0)
            ++i;
        else
            i += j;
    }

    cout << ret << endl;

    return 0;
}

class Solution2 {
public:
    int minSubArrayLen(int target, vector<int>& nums)
    {
        int n = nums.size(), sum = 0, ret = INT_MAX;
        for (int left = 0, right = 0; right < n; ++right)
        {
            sum += nums[right];
            while (sum >= target)
            {
                ret = min(ret, right - left + 1);
                sum -= nums[left++];
            }
        }
        return ret == INT_MAX ? 0 : ret;
    }
};